package com.itheima.Demo1Scanner;

import java.util.Scanner;

public class Demo08 {
    public static void main(String[] args) {
        //1.键盘录入一个字符串,用Scanner实现
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入:");
        String s = sc.next();

        //2.要统计三种类型的字符个数,需要定义三个统计变量,初始值都为0
        int bigCount = 0;
        int smallCount = 0;
        int numeCount = 0;

        //3.遍历字符串,得到每一个字符
        char[] chars = s.toCharArray();
        for(int i = 0; i < chars.length; i++){
            char c = chars[i];
            //4.判断该字符属于那种类型,然后对应类型的统计变量+1
            if(c >= 'A' && c <= 'Z'){
               bigCount++;
            }else if(c >= 'a' && c <= 'z'){
                smallCount++;
            }else if(c >= '0' && c <= '9' ){
                numeCount++;
            }
        }
        //5.输出三种类型的字符个数
        System.out.println("大写字母字符:" + bigCount);
        System.out.println("小写字母字符:" + bigCount);
        System.out.println("数字字母字符:" + bigCount);
    }
}
